package com.android.fragmentdemo.defineviews
import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView

class Dy0202ItemDecoration(mRightSpace: Float) : RecyclerView.ItemDecoration() {
    private val rightSpace = mRightSpace

    override fun getItemOffsets(
        outRect: Rect,
        view: View,
        parent: RecyclerView,
        state: RecyclerView.State
    ) {
        super.getItemOffsets(outRect, view, parent, state)
        //val position = parent.getChildAdapterPosition(view)
        //val itemCount = parent.adapter?.itemCount ?: 0
        outRect.top = rightSpace.toInt()
        outRect.right = rightSpace.toInt()
        outRect.left =  rightSpace.toInt()
    }
}